<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Index extends Controller_Common {

	public $template='layout/index';

	public function action_index() {
		$this->template->header=View::factory('pieces/header');

		$allCat = Model::factory('places')->getAll();

		foreach ($allCat as $item) {
			$allCatalog[$item['parent_id']][] = $item;
		}

		$menu = Model::factory('menu')->getMenu();

		$this->template->leftContent=View::factory('pieces/left_content', array(
			'catalog' => Model::factory('places')->get_countries(),
            'menu' => $menu,
		));

		$this->template->rightContent=View::factory('pages/index', array(
			'slides' => ORM::factory('aslider')->order_by('id', 'DESC')->limit(5)->find_all()
		));

        $this->template->footer=View::factory('pieces/footer', array(
            'menu' => $menu
        ));
	}
}
